package com.nmn.spinningwheel.util;

import android.content.Context;
import android.content.SharedPreferences;

public class CommonUtil {
	public enum REWARDs {
		GIFT_CARD, YELLOW_TYM, MISS, GREEN_TYM, GOLD_TICKET, PHONE_CARD, TURN, PURPLE_TYM
	}

	public static int pixelsFromDP(Context context, int pixels) {
		return (int) (40 * context.getResources().getDisplayMetrics().density + 0.5f);
	}

	public static float getAngle(REWARDs reward) {
		float res = 0.0f;
		switch (reward) {
		case GIFT_CARD:
			break;
		case YELLOW_TYM:
			res += 315;
			break;
		case PURPLE_TYM:
			res += 45;
			break;
		case MISS:
			res += 270;
			break;
		case GREEN_TYM:
			res += 225;
			break;
		case PHONE_CARD:
			res += 135;
			break;
		case GOLD_TICKET:
			res += 180;
			break;
		case TURN:
			res += 90;
			break;
		}
		return res;
	}
	
	public static boolean checkShowConfirmSpin(Context context){
		SharedPreferences shared=context.getSharedPreferences("_appstore_spin",context.MODE_PRIVATE);
		return shared.getBoolean(Constants.DONT_SHOW_CONFIRM_SPIN_AGAIN, true);
	}
	
	public static void disableShowConfirmSpin(Context context){
		SharedPreferences shared=context.getSharedPreferences("_appstore_spin",context.MODE_PRIVATE);
		shared.edit().putBoolean(Constants.DONT_SHOW_CONFIRM_SPIN_AGAIN, false).commit();
	}
}
